Ext.define('DCApp.model.Attach', {
extend: 'DCApp.model.Base',
fields: [
     	{name:'eid', type: 'int'},
     	{name:'ename'},
     	{name:'fname'},
     	{name:'fsize', type: 'int'},
     	{name:'path'},
     	{name:'purpose'},
     	{name:'suffix'},
     	{name:'title'},
     	{name:'content'},
     	{name:'uid', type: 'int'},
     	{name:'ord', type: 'int'},
        {
            name: 'uri',
            calculate: function (data) {
              var path = data.path;
              var pid = data['id'];
              //for simdata
              if(!path || !pid)
            	  return "";
            if(path.indexOf('resources')==0){
				return path;
			}
			path = path.replace(/\\/g,'/');
        	  var uri_m = '/fopen?_dc='+new Date().getTime()
        	  	+'&fp=' +path+'&size=90';
        	  return uri_m;
            }
        },
        {
            name: 'uri_m',
            calculate: function (data) {
              var path = data.path;
              var pid = data['id'];
              //for simdata
              if(!path || !pid)
            	  return '';
              if(path.indexOf('resources')==0){
            	  return path;
              }

              path = path.replace(/\\/g,'/');
        	  var uri_m;
        	  //53上的附件
        	  var id = data['id'];
        	  if(id && id <DCApp.Cfg.ID_START)
        		  uri_m = DCApp.Cfg.WEB_ROOT_CC+'upload'+path;
        	  else
        		  uri_m = '/fopen?_dc='+new Date().getTime()
        		  +'&fp='+path;
        	  return uri_m;
            }
		} ],
		randData: function(i){
			i++;
			var od = this.callParent(arguments);
			od['suffix']='jpg';
			od['path']='resources/imgs/'+i % 5+'.jpg';
			return od;
		}	
     });
